Grails : Tag - link
This page last changed on Mar 09, 2006 by [email protected].
Tag - linkDescriptionCreates a html anchor tag with the href set to based on the parameters specified Parameters
ExamplesExample controller for an application called "shop": BookController.groovy class BookController {
@Property defaultAction="list"
@Property list = { [ books: Book.list( params ) ] }
@Property show = { [ book : Book.get( params['id'] ) ] }
}
Example usages for above controller: <g:link action="show" id="1">Book 1</g:link> == <a href="/shop/book/show/1">Book 1</a> <g:link controller="book">Book Home</g:link> == <a href="/shop/book">Book Home</a> <g:link controller="book" action="list">Book List</g:link> == <a href="/shop/book/list">Book List</a> <g:link url="[action:'list',controller:'book']">Book List</g:link> == <a href="/shop/book/list">Book List</a> Example as a method call in GSP only: <%= link(action:'list',controller:'book') { 'Book List' }%>
Results in: <a href="/shop/book/list">Book List</a> |
Document generated by Confluence on Mar 29, 2006 08:46 |